package com.qf.blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.blog.entity.Comment;
import com.qf.blog.mapper.CommentMapper;
import com.qf.blog.service.ICommentService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author 达哥
 * @since 2023-03-25
 */
@Service
public class CommentServiceImpl extends ServiceImpl<CommentMapper, Comment> implements ICommentService {
    @Override
    public Long getPostCommentSize(Integer postId) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("entity_id", 2);
        wrapper.eq("entity_type", 1);
        // select count(1) from t_comment c where c.entity_id = 2 and c.entity_type = 1
        return baseMapper.selectCount(wrapper);
    }
}
